Skip to content

Conversation

MihaiCristianCondrea
Copy link
Owner

Summary

  • add unit tests verifying CodeViewUtils configures non-null views and skips null entries
  • add CodeHighlighter tests ensuring themes reset patterns and re-highlight syntax

Testing

  • ./gradlew test (fails: Android SDK not installed in container environment)

https://chatgpt.com/codex/tasks/task_e_68c97659fc2c832d88f764f29d83fc35

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex Review: Here are some suggestions.

Reply with @codex fix comments to fix any unresolved comments.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

Comment on lines +21 to +44
@Test
public void applyJavaTheme_resetsPatternsAndReHighlights() {
CodeView codeView = mock(CodeView.class);

CodeHighlighter.applyJavaTheme(codeView);

InOrder order = inOrder(codeView);
order.verify(codeView).resetSyntaxPatternList();
order.verify(codeView).resetHighlighter();
order.verify(codeView, times(5)).addSyntaxPattern(any(Pattern.class), anyInt());
order.verify(codeView).reHighlightSyntax();
}

@Test
public void applyXmlTheme_resetsPatternsAndReHighlights() {
CodeView codeView = mock(CodeView.class);

CodeHighlighter.applyXmlTheme(codeView);

InOrder order = inOrder(codeView);
order.verify(codeView).resetSyntaxPatternList();
order.verify(codeView).resetHighlighter();
order.verify(codeView, times(4)).addSyntaxPattern(any(Pattern.class), anyInt());
order.verify(codeView).reHighlightSyntax();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Avoid Android framework calls in host-unit tests

Both new tests execute CodeHighlighter.apply*Theme, which internally calls android.graphics.Color.parseColor. Because these tests live under app/src/test/java they run on the host JVM without an Android runtime or Robolectric, so parseColor will throw RuntimeException("Stub!") and the suite will fail even when the SDK is installed. Consider moving these checks to androidTest or adding Robolectric/mocking the color parsing so the tests can run in the existing unit-test environment.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant